package com.zoweunion.mechanic.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zoweunion.mechanic.entity.CarPersonEntity;
import com.zoweunion.mechanic.entity.FacilitatorPersonnelRelationEntity;
import com.zoweunion.mechanic.model.app.AssignRegion;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;

/**
 * 
 * 
 * @author xp
 * @email 17688825585@163.com
 * @date 2020-07-22 16:18:41
 */
@Component
public interface FacilitatorPersonnelRelationDao  extends BaseMapper<FacilitatorPersonnelRelationEntity>{

    List<FacilitatorPersonnelRelationEntity> queryPage(@Param("map") Map<String, Object> map);

    List<Map<String,Object>> getServerPhone(@Param("mobilePhone")String mobilePhone);

    /**
     * 查询账号或者手机
     * @param serverAccount
     * @return
     */
    List<Map<String, Object>> getServerAccountInfo(@Param("serverAccount") String serverAccount);

    int insertAssignRegion(@Param("assignRegionList") List<AssignRegion> assignRegionList);

    int updateUserRole(Map<String, Object> reMap);

    int insertUser(Map<String, Object> reqMap);

    int insertUserRole(Map<String, Object> reqMap);

    int addFacilitator(Map<String, Object> reqMap);

    int addUserAccount(Map<String, Object> reMap);

    Map<String,Object> getHasSetedFacilitatorSettingForAddFacilitatorOfRotationChart(@Param("p_id")String p_id);

    Map<String,Object> getServerById(@Param("id")String id);

    int updateFacilitator(Map<String, Object> reqMap);

    List<AssignRegion> selectAssignRegionFacilitatorBySId(String sId);

    int removeAssignRegionfacilitatorBySId(@Param("sId") String sId);

    void removeAssignRegionWithFacilitatorBySId(AssignRegion assignRegion);

    void addServerRelation(@Param("serverSid")String serverSid, @Param("sId")String sId);

    /**
     * 删除服务商
     *
     * @param reqMap
     * @return
     */
    int deleteFacilitator(Map<String, Object> reqMap);

    /**
     * 删除服务商 车主车辆绑定表
     * @param reqMap
     * @return
     */
    int deleteFacilitatorOwnerCar(Map<String, Object> reqMap);

    /**
     * 移除服务商的所有负责区域,包括员工数据
     * @param sId
     * @return
     */
    int logicRemoveAssignRegionBySId(@Param("sId") String sId);

    /**
     * 删除服务商 车主车辆绑定表
     * @param reqMap
     * @return
     */
    int deleteFacilitatorOwnerCarById(Map<String, Object> reqMap);

    /**
     * 根据车id和服务商id服务商解绑车辆 车主车辆绑定表
     * @param cId
     * @param sId
     * @return
     */
    int deleteFacilitatorOwnerCarByCarIdAndSid(@Param("s_id") String sId, @Param("c_id") String cId, @Param("update_user") String updateUser);

    /**
     * 删除服务商 车辆绑定表
     * @param reqMap
     * @return
     */
    int deleteFacilitatorThings(Map<String, Object> reqMap);

    /**
     * 删除服务商 车辆表
     * @param reqMap
     * @return
     */
    int deleteFacilitatorCar(Map<String, Object> reqMap);

    /**
     * 移除服务商权限
     * @param reMap
     * @return
     */
    int removeFacilitatorPermission(Map<String, Object> reMap);

    /**
     * 根据服务商id，设置用户服务商id为null，并且更新用户角色
     * @param reMap
     * @return
     */
    int updateUserRoleBySId(Map<String, Object> reMap);

    int deleteFacilitatorRelation(@Param("reqMap")Map<String, Object> reqMap);

    List<Map<String, Object>> facilitatorList(Map<String, Object> reqMap);

    int selectCarByThingsId(@Param("thingsId")String thingsId);

    void insertCar(@Param("carPersonEntity")CarPersonEntity carPersonEntity);

    void insertUserInfo(@Param("item")Map<String, Object> item);

    double selectCountHour(@Param("thingsId")String thingsIds);

    int selectByUserAccount(@Param("item")Map<String, Object> item);

    int selectHumanfaceByUser(@Param("thingsId")String thingsId, @Param("mobilePhone")String mobilePhone);

    void insertRelation(@Param("item")Map<String, Object> item);

    List<Map<String,Object>> carList(@Param("item")Map<String, Object> reqMap);

    List<Map<String,Object>> carInfo(@Param("item")Map<String, Object> reqMap);

    void carDelete(@Param("item") Map<String, Object> reqMap);

    void updateCar(@Param("item")CarPersonEntity carPersonEntity);

    void updateUserInfo(@Param("item")Map<String, Object> item);

    void carListDelete(@Param("item")Map<String, Object> reqMap);

    List<Map<String,Object>> facilitatorByList(@Param("item")Map<String, Object> reqMap);

    void insertUserInfoHuman(@Param("item")Map<String, Object> item);

    void insertOwnerUser(@Param("id")String uuid, @Param("carId")String carId,
                         @Param("sid")String sid);

    List<Map<String,Object>> certificateList(@Param("item")Map<String, Object> reqMap);

    int certificateCount(@Param("item")Map<String, Object> map);

    int selectAlarm(@Param("thingsId")String thingsId);

    int selectCer(@Param("thingsId")String thingsId,@Param("serverSid") String serverSid);

    List<Map<String,Object>> alarmList(@Param("thingsId")String thingsId);

    void carDeleteInfo(@Param("item")Map<String, Object> reqMap);

    String selectByUserInfo(@Param("item")Map<String, Object> item);

    void updateUserInfoHuman(@Param("item")Map<String, Object> item);

    List<Map<String, Object>> equipmentList(@Param("item")Map<String, Object> item);

    void insertIntoServiceThings(@Param("id")String id,
                                 @Param("thingsId")String item,@Param("sid") String sid);

    List<Map<String,Object>> equipmentListAll(@Param("item")Map<String, Object> item);

    void updateEquipmentBatch(@Param("thingsId")String item, @Param("sid")String sid, @Param("pSId")String pSId);

    List<String> equipmentListRemove(@Param("item")Map<String, Object> reqMap);


    void updateEquipmentType(@Param("thingsId")String entityThingsId,
                             @Param("sid")String sid,
                             @Param("type")Integer type);

    Map<String,Object> selectCar(@Param("id")String id);

    List<String> listServerMenuPermission(@Param("s_id") String sId, @Param("allPermission") boolean allPermission);

    void insertRoleServer(Map<String, Object> rolePermission);

    List<Map<String,Object>> selectCarListCon(@Param("item")Map<String, Object> reqMap);

    Map<String,Object> selectHuman(@Param("things_id")String things_id);

    void updateHuman(@Param("id")int id);

    void insertHuman(@Param("thingsId")String things_id);

    void updateHumanFaceId(@Param("item")Map<String, Object> reqMap);

    List<Map<String,Object>> selectUserInfoHuman(@Param("item")Map<String, Object> item);

    List<String> selectCountBySid(@Param("sId")String sId);

    List<String> selectCountByUserId(@Param("userId") String userId);

    List<String> selectCountByBankingSid(@Param("s_id")String s_id);

    long selectPersonCount(@Param("sId")String serverString);

    long selectCarCount(@Param("sId")String serverString, @Param("type")int i);

    List<Map<String,Object>> selectServerInfo(@Param("sId")String serverString);

    List<Map<String,Object>> selectCarInfo(@Param("item")String item);

    Map<String,Object> selectInfoByCar(@Param("item")Map<String, Object> params);

    Map<String,Object> getFacilitatorInfo(@Param("id") String id);

    /**
     * 获取服务商的所有负责区域编号，字符串拼接形式
     * @param sId
     * @return
     */
    List<Map<String, String>> selectAreaNumberAssignRegionFacilitatorBySId(@Param("sId") String sId);

    List<Map<String, Object>> manuList(@Param("reqMap")Map<String, Object> reqMap);

    void updateManu(@Param("id")String item,@Param("sid") String sid);

    List<Map<String,Object>> manuListBySid(@Param("reqMap")Map<String, Object> reqMap);

    void removeManu(@Param("id")String item,@Param("sid")  String sid);

    int selectManuSid(@Param("item")Map<String, Object> item);

    void insertManuSid(@Param("item")Map<String, Object> item);

    List<Map<String,Object>> carBySid(@Param("item")Map<String, Object> reqMap
                                        ,@Param("serverString")String serverString);

    int selectManuOnly(@Param("item")Map<String, Object> item);

    int selectThingsOnly(@Param("item")Map<String, Object> item);

    void updateThingsRegister(@Param("thingsId")String thingsId,@Param("sid") String sid);

    void updateCarDelete(@Param("id")String id, @Param("sId")String sId);

    void updateThingsDelete(@Param("thingsId")String thingsId);

    int selectThingsExit(@Param("thingsId")String thingsId);

    void updateThingsDeliver(@Param("thingsId")String entityThingsId,
                             @Param("sid")String sid,
                             @Param("type")Integer type);

    void updateServiceThings(@Param("thingsId")String item,@Param("sid") String sid,@Param("pid") String pid);

    Map<String,Object> selectKtblDay(@Param("table")String table,@Param("thingsId") String item
                                            ,@Param("day") int day);

    Map<String,Object> selectKtblDayInfo(@Param("table")String table,@Param("thingsId") String item
            ,@Param("day") int day);

    Map<String,Object> selectKtblDayFuelGaugeInfo(@Param("table")String table,@Param("thingsId") String item
            ,@Param("day") int day);

    Map<String, Object> selectKtblDaySource(@Param("table")String table,@Param("thingsId") String item
            ,@Param("day") int day);

    String selectKtblDayWork(@Param("thingsId")String item
            ,@Param("day") int day);

    void insertDay(@Param("map")Map<String, Object> item1);

    void insertDayLog(@Param("thingsIds")String item1,@Param("msg") String msg,
                      @Param("type") int i,@Param("status") int i1);

    List<Map<String,Object>> selectLastMonth();

    Map<String,Object> selectCountMonth(@Param("thingsId")String thingsIds);

    Map<String,Object> selectCountMonthLast(@Param("thingsId")String thingsIds);

    void insertMonth(@Param("map")Map<String, Object> item1);

    long selectByMonth(@Param("map")String item1);

    List<Map<String,Object>> selectKtThingsIds();


    List<String> selectServer();

    Map<String,Object> selectLastFuel(@Param("table")String table,@Param("thingsId") String item
            ,@Param("day") int day);

    Map<String, Object> carInfoOwner(@Param("map")Map<String, Object> params);

    int getThingsIdCount(Map<String, Object> reqMap);

    int getCarIdCount(Map<String, Object> reqMap);

    void uploadLockLimit(Map<String, Object> reqMap);

    Map<String, Object> carInfoOwnerVideoInfo(Map<String, Object> params);

    int setFacilitatorCarLockPolicy(Map<String, Object> reqMap);

    int updateFacilitatorCarLockPolicy(Map<String, Object> reqMap);

    //金融平台向主机厂发物联网卡
    void updateParentThings(Map<String, Object> reqMap);
    //金融平台向服务商发物联网卡
    void updateNewThings(Map<String, Object> reqMap);

    List<Map<String, Object>> getThingsList(Map<String, Object> reqMap);

    void updateEquipmentBatchOfFinancial(@Param("map") Map<String, Object> reqMap);

    List<Map<String, Object>> getCarOwnerApplyUnlockList(Map<String, Object> reqMap);

    int updateOwnerApplyUnlockById(Map<String, Object> reqMap);

    Map<String, Object> getCarInfoWithOwnerInfo(@Param("car_id")String carId);
}
